<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'order.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css">
<script type="text/javascript"
	src="<%=basePath%>My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.8.3.js"></script>
</head>

<body>
	<ul id="tabsmenu" class="tabsmenu">
		<li class="active"><a>预约课程</a>
		</li>
	</ul>
	<div id="tab1" class="tabcontent">
		<div class="form">
			<form action="insureOrder.action" method="POST">
				<div class="form_row">
					<label>预约时间:</label> <input name="date" class="form_input"
						type="text" id="d15" onClick="WdatePicker()" />
				</div>
				<div class="form_row">
					<label>课程名:</label> <input type="text" class="form_input"
						name="course" />
				</div>
				<c:if test="${teacher.username!='admin' }">
					<input type="hidden" value="${teacher.name }" name="name">
				</c:if>
				<c:if test="${teacher.username=='admin' }">
					<div class="form_row">
						<label>教师名:</label> <input type="text" class="form_input"
							name="name" value="" />
					</div>
				</c:if>
				<div class="form_row">
					<label>班级:</label> <input type="text" class="form_input"
						name="clsname" />
				</div>
				<div class="form_row">
					<label>人数:</label> <input type="text" class="form_input"
						name="number" />
				</div>
				<div class="form_row">
					<label>实验室：</label> <select id="labelRoom" class="form_input"
						status="false" name="labid">
						<option value="0">---------请选择---------</option>
					</select>
				</div>
				<div class="form_row">
					<label>节次：</label> <select class="form_input" name="type">
						<option value="1">第一大节</option>
						<option value="2">第二大节</option>
						<option value="3">第三大节</option>
						<option value="4">第四大节</option>
					</select>
				</div>
				<div class="form_row">
					<input type="submit" class="form_submit" value="Submit" />
				</div>
				<div class="clear"></div>
			</form>
		</div>
	</div>
</body>

<script type="text/javascript">
	$(document).ready(function(){
		var status = $("#labelRoom").attr("status");
		if("false"==status){
			$.ajax({
				type : "post",
				url : "ajaxlab.action",
				dataType: "json",
				success : function (data){
					var content = "";
					$.each(data,function(i,item){
						var LId = item["LId"];
						var labName = item["labName"];
						content += "<option value='"+LId+"'>"+labName+"</option>";
					});
					$("#labelRoom").append(content);
					$("#labelRoom").attr("status","true");
				},
				error : function (XMLHttpRequest, textStatus, errorThrown){
        			console.info(errorThrown);
    			}
			});
		}
	});
</script>

</html>

